<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #showtime{
            text-align: center;
            width: auto;
            height: auto;
        }
        .a11{
            text-align: center;
        }
        #emo{
            text-align: center;
        }
    </style>
</head>
<body>
    <div id="showtime"></div>
    <div class="a11"><button type="button" onclick="mystopfunction()">暂停！</button>
                     <button type="button" onclick="mygoonfunction()">继续！</button>
    </div>
    
    <div id="container"></div>
    <script>
        var music = document.getElementById('myMusic');
        var utime = prompt('请输入结束时间','2022-3-5 18:00:00');
        var Myvar = setInterval(myfunction,1000);
    function countTime(time){
    var nowtime = new Date();  
    var inputTime = new Date(time); 
    var times = (inputTime - nowtime) / 1000;
    if (times >= 0){
    var d = parseInt(times / 60 / 60 / 24); 
    d = d < 10 ? '0'+ d : d;
    var h = parseInt(times / 60 / 60 % 24);
    h = h < 10 ? '0'+ h : h;  
    var m = parseInt(times / 60 % 60);
    m = m < 10 ? '0'+ m : m;   
    var s = parseInt(times % 60);
    s = s < 10 ? '0'+ s : s;  
    return d + "天" + h + "时" + m + "分" + s + "秒";
}else{
    play();
    clearInterval(Myvar);
}
}
    function myfunction(){
        document.getElementById('showtime').innerHTML = countTime(utime);  
    }
    function mystopfunction(){
        clearInterval(Myvar);
    }
    function  mygoonfunction(){
        Myvar = setInterval(myfunction,1000)
    }
    function play(){
    var div = document.getElementById('container');
    var audio = document.createElement('audio');
    div.appendChild(audio);
    audio.src='../音乐/my - 做我老婆好不好（原版）.flac';
    audio.autoplay='autoplay';
    }
    </script>
</body>
</html>